﻿using AutoClickTool.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Media;
using System.Text;
using System.Threading.Tasks;

namespace AutoClickTool.Common
{
    public class MusicPlayer
    {
        Dictionary<MusicPlayerEnum, SoundPlayer> SoundPlayerPool = new Dictionary<MusicPlayerEnum, SoundPlayer>();
        public MusicPlayer()
        {
            //var rootPath = Application.StartupPath;
            //SoundPlayerPool.Add(MusicPlayerEnum.Start,new SoundPlayer(Path.Combine(rootPath, "Files\\Music\\start.wav")));
            //SoundPlayerPool.Add(MusicPlayerEnum.End,new SoundPlayer(Path.Combine(rootPath, "Files\\Music\\end.wav")));
        }

        public void Load()
        {
            foreach (var item in SoundPlayerPool.Values)
            {
                item.Load();
            }
        }
        public void Play(MusicPlayerEnum playerEnum)
        {
            //var rootPath = Application.StartupPath;
            //if (playerEnum == MusicPlayerEnum.Start)
            //{
            //    using SoundPlayer player1 = new SoundPlayer(Path.Combine(rootPath, "Files\\Music\\end.wav"));
            //    player1.Load();
            //    player1.Play();
            //}
            //else
            //{
            //    using SoundPlayer player = new SoundPlayer(Path.Combine(rootPath, "Files\\Music\\start.wav"));
            //    player.Load();
            //    player.Play();
            //}
            SystemSounds.Asterisk.Play();
        }
    }
}
